package com.mazaiting.accessibility.base

import android.accessibilityservice.AccessibilityService
import android.view.accessibility.AccessibilityEvent


/***
 *
 *
 *                                                    __----~~~~~~~~~~~------___
 *                                   .  .   ~~//====......          __--~ ~~
 *                   -.            \_|//     |||\\  ~~~~~~::::... /~
 *                ___-==_       _-~o~  \/    |||  \\            _/~~-
 *        __---~~~.==~||\=_    -_--~/_-~|-   |\\   \\        _/~
 *    _-~~     .=~    |  \\-_    '-~7  /-   /  ||    \      /
 *  .~       .~       |   \\ -_    /  /-   /   ||      \   /
 * /  ____  /         |     \\ ~-_/  /|- _/   .||       \ /
 * |~~    ~~|--~~~~--_ \     ~==-/   | \~--===~~        .\
 *          '         ~-|      /|    |-~\~~       __--~~
 *                      |-~~-_/ |    |   ~\_   _-~            /\
 *                           /  \     \__   \/~                \__
 *                       _--~ _/ | .-~~____--~-/                  ~~==.
 *                      ((->/~   '.|||' -_|    ~~-/ ,              . _||
 *                                 -_     ~\      ~~---l__i__i__i--~~_/
 *                                 _-~-__   ~)  \--______________--~~
 *                               //.-~~~-~_--~- |-------~~~~~~~~
 *                                      //.-~~~--\
 *                               神兽保佑
 *                              代码无BUG!
 * @author mazaiting
 * @date 2019-07-24
 * @description 自动点击服务
 * 查看结点信息: Android Studio -> Tools -> Layout Inspector
 * aapt 位置: /sdk/build-tools/xx.x.x/aapt
 * 查看包信息: ./aapt dump badging /rimet_10002068.apk
 * 在 strings.xml 文件中添加以下两个字符串，可替换内容
 * <string name="accessibility_desc">Test</string>
 * <string name="accessibility_tip">Test</string>
 */
class CustomAccessibilityService : AccessibilityService() {

    override fun onCreate() {
        super.onCreate()
        AccessibilityOperator.INSTANCE.registerAccessibilityService(this)
    }

    override fun onServiceConnected() {
        super.onServiceConnected()
        AccessibilityOperator.INSTANCE.onServiceConnected()
    }

    override fun onAccessibilityEvent(event: AccessibilityEvent?) {
        if (null != event)
            AccessibilityOperator.INSTANCE.onAccessibilityEvent(event)
    }

    override fun onInterrupt() {

    }

    override fun onDestroy() {
        AccessibilityOperator.INSTANCE.unregisterAccessibilityService()
        super.onDestroy()
    }

}